#include <iostream>
using namespace std;
int data[100][100];
int main(){
	int a,b,c,d,e;
	cin>>a>>b>>c>>d>>e;
	for(int i=0;i<a;i++){
		for(int j=0;j<b;j++){
			cin>>data[i][j];
			if(data[i][j]>c && data[i][j]<d){
				data[i][j]=e;
			}			
		}
	}
		for(int i=0;i<a;i++){
			int count=0;
		for(int j=0;j<b;j++){
		if(count!=0) cout<<" ";
		printf("%03d",data[i][j]);
		count++;
		}
		cout<<endl;
	}
	return 0;
}
